#include "subsets.h"

std::vector<std::vector<int>> subsets(std::vector<int> &nums) {
    const int n = nums.size();
    std::vector<std::vector<int>> cache;
    std::vector<int> sets;
    for (int mask = 0; mask < (1 << n); mask++) {
        sets.clear();
        for (int i = 0; i < n; i++) {
            if (mask & (1 << i)) {
                sets.push_back(nums[i]);
            }
        }
        cache.push_back(sets);
    }
    return cache;
}
